import request from '@/utils/request'

// USER_CODE_BEGIN -- distributor_commission
/**
 * 获取分销佣金记录列表
 * @param params
 * @returns
 */
export function getDistributorCommissionList(params: Record<string, any>) {
    return request.get(`distributor/distributor_commission`, {params})
}

/**
 * 获取分销佣金记录详情
 * @param id 分销佣金记录id
 * @returns
 */
export function getDistributorCommissionInfo(id: number) {
    return request.get(`distributor/distributor_commission/${id}`);
}

/**
 * 添加分销佣金记录
 * @param params
 * @returns
 */
export function addDistributorCommission(params: Record<string, any>) {
    return request.post('distributor/distributor_commission', params, { showErrorMessage: true, showSuccessMessage: true })
}

/**
 * 编辑分销佣金记录
 * @param id
 * @param params
 * @returns
 */
export function editDistributorCommission(params: Record<string, any>) {
    return request.put(`distributor/distributor_commission/${params.id}`, params, { showErrorMessage: true, showSuccessMessage: true })
}

/**
 * 删除分销佣金记录
 * @param id
 * @returns
 */
export function deleteDistributorCommission(id: number) {
    return request.delete(`distributor/distributor_commission/${id}`, { showErrorMessage: true, showSuccessMessage: true })
}



// USER_CODE_END -- distributor_commission


// USER_CODE_BEGIN -- distributor_config
/**
 * 获取系统参数列表
 * @param params
 * @returns
 */
export function getDistributorConfigList(params: Record<string, any>) {
    return request.get(`distributor/distributor_config`, {params})
}

/**
 * 获取系统参数详情
 * @param id 系统参数id
 * @returns
 */
export function getDistributorConfigInfo(id: number) {
    return request.get(`distributor/distributor_config/${id}`);
}

/**
 * 添加系统参数
 * @param params
 * @returns
 */
export function addDistributorConfig(params: Record<string, any>) {
    return request.post('distributor/distributor_config', params, { showErrorMessage: true, showSuccessMessage: true })
}

/**
 * 编辑系统参数
 * @param id
 * @param params
 * @returns
 */
export function editDistributorConfig(params: Record<string, any>) {
    return request.put(`distributor/distributor_config/${params.id}`, params, { showErrorMessage: true, showSuccessMessage: true })
}

/**
 * 删除系统参数
 * @param id
 * @returns
 */
export function deleteDistributorConfig(id: number) {
    return request.delete(`distributor/distributor_config/${id}`, { showErrorMessage: true, showSuccessMessage: true })
}



// USER_CODE_END -- distributor_config


// USER_CODE_BEGIN -- member_dividend

/**
 * 获取用户分红记录统计
 * @param params
 * @returns
 */
export function getMemberDividendTotal(params: Record<string, any>) {
    return request.get(`distributor/member_dividend/total`, {params})
}

/**
 * 获取用户分红记录列表
 * @param params
 * @returns
 */
export function getMemberDividendList(params: Record<string, any>) {
    return request.get(`distributor/member_dividend`, {params})
}

/**
 * 获取用户分红记录详情
 * @param id 用户分红记录id
 * @returns
 */
export function getMemberDividendInfo(id: number) {
    return request.get(`distributor/member_dividend/${id}`);
}

/**
 * 添加用户分红记录
 * @param params
 * @returns
 */
export function addMemberDividend(params: Record<string, any>) {
    return request.post('distributor/member_dividend', params, { showErrorMessage: true, showSuccessMessage: true })
}

/**
 * 编辑用户分红记录
 * @param id
 * @param params
 * @returns
 */
export function editMemberDividend(params: Record<string, any>) {
    return request.put(`distributor/member_dividend/${params.id}`, params, { showErrorMessage: true, showSuccessMessage: true })
}

/**
 * 删除用户分红记录
 * @param id
 * @returns
 */
export function deleteMemberDividend(id: number) {
    return request.delete(`distributor/member_dividend/${id}`, { showErrorMessage: true, showSuccessMessage: true })
}



/**
 * 获取用户分红记录二列表
 * @param params
 * @returns
 */
export function getMemberDividendTwoList(params: Record<string, any>) {
    return request.get(`distributor/member_dividend_two`, {params})
}

// USER_CODE_END -- member_dividend


// USER_CODE_BEGIN -- points_dividend

/**
 * 获取绿色积分记录列表
 * @param params
 * @returns
 */
export function getPointsDividendList(params: Record<string, any>) {
    return request.get(`distributor/points_dividend`, {params})
}

/**
 * 获取绿色积分记录详情
 * @param id 绿色积分记录id
 * @returns
 */
export function getPointsDividendInfo(id: number) {
    return request.get(`distributor/points_dividend/${id}`);
}

/**
 * 添加绿色积分记录
 * @param params
 * @returns
 */
export function addPointsDividend(params: Record<string, any>) {
    return request.post('distributor/points_dividend', params, { showErrorMessage: true, showSuccessMessage: true })
}

/**
 * 编辑绿色积分记录
 * @param id
 * @param params
 * @returns
 */
export function editPointsDividend(params: Record<string, any>) {
    return request.put(`distributor/points_dividend/${params.id}`, params, { showErrorMessage: true, showSuccessMessage: true })
}

/**
 * 删除绿色积分记录
 * @param id
 * @returns
 */
export function deletePointsDividend(id: number) {
    return request.delete(`distributor/points_dividend/${id}`, { showErrorMessage: true, showSuccessMessage: true })
}



// USER_CODE_END -- points_dividend

/**
 * 获取首页统计
 * @param params
 * @returns
 */
export function getHomepageStatistics(params?: Record<string, any>) {
    return request.get(`distributor/homepage/statistics`, {params})
}


// USER_CODE_BEGIN -- points_log
/**
 * 获取积分变动记录列表
 * @param params
 * @returns
 */
export function getPointsLogList(params: Record<string, any>) {
    return request.get(`distributor/points_log`, {params})
}

/**
 * 获取积分变动记录统计
 * @param params
 * @returns
 */
export function getPointsLogStatistics(params: Record<string, any>) {
    return request.get(`distributor/statistics`, {params})
}

/**
 * 获取积分变动记录详情
 * @param id 积分变动记录id
 * @returns
 */
export function getPointsLogInfo(id: number) {
    return request.get(`distributor/points_log/${id}`);
}

/**
 * 添加积分变动记录
 * @param params
 * @returns
 */
export function addPointsLog(params: Record<string, any>) {
    return request.post('distributor/points_log', params, { showErrorMessage: true, showSuccessMessage: true })
}

/**
 * 编辑积分变动记录
 * @param id
 * @param params
 * @returns
 */
export function editPointsLog(params: Record<string, any>) {
    return request.put(`distributor/points_log/${params.id}`, params, { showErrorMessage: true, showSuccessMessage: true })
}

/**
 * 删除积分变动记录
 * @param id
 * @returns
 */
export function deletePointsLog(id: number) {
    return request.delete(`distributor/points_log/${id}`, { showErrorMessage: true, showSuccessMessage: true })
}

// USER_CODE_END -- points_log

// USER_CODE_BEGIN -- member_points
/**
 * 获取用户积分账户列表
 * @param params
 * @returns
 */
export function getMemberPointsList(params: Record<string, any>) {
    return request.get(`distributor/member_points`, {params})
}

/**
 * 获取用户积分账户详情
 * @param id 用户积分账户id
 * @returns
 */
export function getMemberPointsInfo(id: number) {
    return request.get(`distributor/member_points/${id}`);
}

/**
 * 添加用户积分账户
 * @param params
 * @returns
 */
export function addMemberPoints(params: Record<string, any>) {
    return request.post('distributor/member_points', params, { showErrorMessage: true, showSuccessMessage: true })
}

/**
 * 编辑用户积分账户
 * @param id
 * @param params
 * @returns
 */
export function editMemberPoints(params: Record<string, any>) {
    return request.put(`distributor/member_points/${params.id}`, params, { showErrorMessage: true, showSuccessMessage: true })
}

/**
 * 删除用户积分账户
 * @param id
 * @returns
 */
export function deleteMemberPoints(id: number) {
    return request.delete(`distributor/member_points/${id}`, { showErrorMessage: true, showSuccessMessage: true })
}

// USER_CODE_END -- member_points